Techniques for instruction group formation for decode-time instruction optimization based on feedback

ABSTRACT

A technique of processing instructions for execution by a processor includes determining whether a first property of a first instruction and a second property of a second instruction are compatible. The first instruction and the second instruction are grouped in an instruction group in response to the first and second properties being compatible and a feedback value generated by a feedback function indicating the instruction group has been historically beneficial with respect to a benefit metric of the processor. Group formation for the first and second instructions is performed according to another criteria, in response to the first and second properties being incompatible or the feedback value indicating the grouping of the first and second instructions has not been historically beneficial.

BACKGROUND

The disclosure is generally directed to techniques for instruction groupformation and, more particularly, to techniques for instruction groupformation for decode-time instruction optimization based on feedback.

Traditionally, processors employed in conventional computer systems(data processing systems) executed program instructions one at a time insequential order. The process of executing a single instruction hasusually included several sequential steps. A first step generallyinvolved fetching the instruction from a storage device. A second stepgenerally involved decoding the instruction and assembling any operands.A third step generally involved executing the instruction and storingthe results. Some processors have been designed to perform each step ina single processor clock cycle. Other processors have been designed sothat the number of processor clock cycles per step depends on theinstruction. Modern data processing systems commonly use an instructioncache memory (cache) to temporarily store blocks of instructions. As isknown, caches are buffers that store information retrieved from mainmemory to facilitate accessing the information with lower latency. If aprocessor locates a desired instruction (or data) in a cache, a ‘cachehit’ occurs and instruction execution speed is generally increased ascache tends to be faster than main memory. However, if a cache does notcurrently store a desired instruction (or data), a ‘cache miss’ occursand a block that includes the desired instruction (or data) must bebrought into the cache (i.e., retrieved from main memory).

Fetching instructions from cache (or main memory) is normally controlledby a program counter. Contents of a program counter typically indicate astarting memory address from which a next instruction or instructions isto be fetched. Depending on processor design, each instruction may havea fixed length or a variable length. For example, a processor may bedesigned such that all instructions have a fixed length of thirty-twobits (i.e., four bytes). Fixed length instruction formats tend tosimplify the instruction decode process. Modern data processing systemscommonly use a technique known as pipelining to improve performance.Pipelining involves the overlapping of sequential steps of an executionprocess. For example, while a processor is performing an execution stepfor one instruction, the processor may simultaneously perform a decodestep for a second instruction and a fetch of a third instruction. Assuch, pipelining can decrease execution time for an instructionsequence. Superpipelined processors attempt to further improveperformance by overlapping the sub-steps of the three sequential stepsdiscussed above.

Another technique for improving processor performance involves executingtwo or more instructions in parallel. Processors that execute two ormore instructions in parallel are generally referred to as superscalarprocessors. The ability of a superscalar processor to execute two ormore instructions simultaneously depends on the particular instructionsbeing executed. For example, two instructions that both require use of asame processor resource (e.g., a same floating point unit (FPU)) cannotbe executed simultaneously, as a resource conflict would occur. Twoinstructions that both require use of the same processor resource cannotusually be combined or grouped with each other for simultaneousexecution, but must usually be executed alone or grouped with otherinstructions. Additionally, an instruction that depends on the resultproduced by execution of a previous instruction cannot usually begrouped with the previous instruction. An instruction that depends onthe result of the previous instruction is said to have a data dependencyon the previous instruction. Similarly, an instruction may have aprocedural dependency on a previous instruction that prevents theinstructions from being grouped in a same group. For example, aninstruction that follows a branch instruction cannot usually be groupedwith the branch instruction, since the execution of the instructiondepends on whether the branch is taken.

BRIEF SUMMARY

A technique of processing instructions for execution by a processorincludes determining whether a first property of a first instruction anda second property of a second instruction are compatible. The firstinstruction and the second instruction are grouped in an instructiongroup in response to the first and second properties being compatibleand a feedback value generated by a feedback function indicating theinstruction group has been historically beneficial with respect to abenefit metric of the processor. Group formation is performed accordingto another criteria for the first and second instructions, in responseto the first and second properties being incompatible or the feedbackvalue indicating the grouping of the first and second instructions hasnot been historically beneficial.

The above summary contains simplifications, generalizations andomissions of detail and is not intended as a comprehensive descriptionof the claimed subject matter but, rather, is intended to provide abrief overview of some of the functionality associated therewith. Othersystems, methods, functionality, features and advantages of the claimedsubject matter will be or will become apparent to one with skill in theart upon examination of the following figures and detailed writtendescription.

The above as well as additional objectives, features, and advantages ofthe present invention will become apparent in the following detailedwritten description.

BRIEF DESCRIPTION OF THE DRAWINGS

The description of the illustrative embodiments is to be read inconjunction with the accompanying drawings, wherein:

FIG. 1 is a diagram of a relevant portion of an exemplary dataprocessing system environment that includes a data processing systemthat is configured to group instructions for decode-time instructionoptimization (DTIO), according to the present disclosure;

FIG. 2A is a diagram of relevant portions of an exemplary processorimplemented in the data processing system of FIG. 1;

FIG. 2B is a flowchart of an exemplary instruction group formationprocess;

FIG. 2C is a flowchart of an exemplary DTIO process;

FIG. 3 is a diagram of an exemplary instruction sequence thatillustrates multiple instruction groups in which one of the instructiongroups includes instructions that can be fused due to how theinstruction groups were formed;

FIG. 4 is a diagram of an exemplary instruction sequence thatillustrates multiple instruction groups in which none of the instructiongroups includes instructions that can be fused due to how theinstruction groups were formed;

FIG. 5 is a diagram of an instruction sequence that illustrates multipleinstruction groups that have boundaries that were created based onfusion instruction candidates;

FIG. 6 is a diagram of an instruction sequence that illustrates multiplesingle instruction groups, whose boundaries were created based on fusioncandidates, that may reduce processor performance;

FIG. 7A is a flowchart of another exemplary instruction group formationprocess;

FIG. 7B is a flowchart of an exemplary process for analyzinginstructions and creating instruction property information that isimplemented by a predecode unit, according to the present disclosure;

FIG. 7C is a flowchart of an exemplary instruction processing frominstruction fetch to execution; and

FIG. 8 is a flowchart of an exemplary process for forming instructiongroups for DTIO based on feedback that is implemented by a groupformation unit, according to the present disclosure.

DETAILED DESCRIPTION

The illustrative embodiments provide a method, a processor, and a dataprocessing system configured to group instructions for decode-timeinstruction optimization (DTIO) based on feedback.

In the following detailed description of exemplary embodiments of theinvention, specific exemplary embodiments in which the invention may bepracticed are described in sufficient detail to enable those skilled inthe art to practice the invention, and it is to be understood that otherembodiments may be utilized and that logical, architectural,programmatic, mechanical, electrical and other changes may be madewithout departing from the spirit or scope of the present invention. Thefollowing detailed description is, therefore, not to be taken in alimiting sense, and the scope of the present invention is defined by theappended claims and equivalents thereof.

It is understood that the use of specific component, device and/orparameter names are for example only and not meant to imply anylimitations on the invention. The invention may thus be implemented withdifferent nomenclature/terminology utilized to describe thecomponents/devices/parameters herein, without limitation. Each termutilized herein is to be given its broadest interpretation given thecontext in which that term is utilized. As used herein, the term‘coupled’ may encompass a direct connection between components orelements or an indirect connection between components or elementsutilizing one or more intervening components or elements. As may be usedherein, the term ‘system memory’ is synonymous with the term ‘mainmemory’ and does not include ‘cache’ or ‘cache memory’. While variousPowerPC™ instructions are referenced herein, it should be appreciatedthat the present disclosure is not limited to the instruction setarchitecture (ISA) employed by PowerPC.

In general, a superscalar processor must be able to determine whethertwo or more given instructions can be grouped. Since a groupingdetermination that does not employ speculation cannot be made withoutfirst decoding instructions, grouping determinations have commonly beenmade by an instruction decode unit as instructions are fetched fromcache. Compiler techniques may also be used to assist an instructiondecode unit in determining (as instructions are fetched from cache)whether two or more instructions can be executed in parallel. When aprocessor decodes instructions from cache there are penalties that maybe incurred. A first penalty occurs during an instruction cache miss. Acache miss delays execution time as instructions must first be fetchedfrom main memory (which is typically slower than cache) and thendecoded. Additionally, decoding on-the-fly significantly slows the speedof instruction execution, since execution of the instruction must waitfor the instruction decode unit (with the aid of compilers and softwarein some systems) to decide if there are any data dependencies,procedural dependencies, and/or resource conflicts (before dispatchinginstructions for optimal simultaneous execution).

To speed-up instruction execution time, some compiler systems haveattempted to gather information regarding the feasibility of groupinginstructions for simultaneous dispatch, prior to the instructions beingfetched from an instruction cache (or combination instruction and datacache). Compiler systems that gather grouping information may facilitatesimplification of instruction decode unit hardware. To gatherinformation prior to instructions being fetched from cache, someconventional superscalar processor system architectures utilize softwarecompilers when generating machine instructions from source code todetermine (in advance of fetching the instruction from cache) whethergroups of instructions can be dispatched simultaneously to processorfunctional units. Such conventional systems may then encode one or morebits in an actual instruction operational code (opcode) to be utilizedby the instruction decode unit hardware.

There are a number of disadvantages associated with compiler predecodetechniques. A first disadvantage of compiler predecode techniques isthat predecode information is employed as part of an ISA, which meansthat every possible processor implementation must interpret thepredecode information identically to have compiled code performoptimally. In this case, flexibility for every possible processorimplementation to optimize the number and encoding of the predecodedinformation in opcode is sacrificed. A second disadvantage of compilerpredecode techniques is that performance improvements in superscalarinstruction execution can only be realized on code that was generatedwith compilers that are modified to correctly predecode instructions andencode the opcode bits correctly. A third disadvantage is that thecompiler predecode techniques require using bits in an actualinstruction opcode, which reduces the amount of information that canotherwise be encoded (restricting how many bits of predecode informationcan practically be used by the system).

A known data processing system implements a predecode unit, coupledbetween main memory and cache, that produces predecode bits forinstructions as the instructions are copied from the main memory to thecache. The predecode unit includes two paths for transportinginstruction information: a predecode path; and an instruction path. Theinstruction path buffers instructions sent from main memory to cache asinformation from the instructions are decoded in the predecode path. Thepredecode path detects what type of instructions are filling a cachemiss and detects whether two instructions can be grouped. The predecodeinformation is stored in cache, along with the instruction pairs aspredecode bits. Predecode bits may be stored with instruction pairs inindividual predecode-bit storage or the predecode bits may be storedelsewhere in the system for optimum utilization.

Due to the desire for high-frequency and relatively short processorpipelines in modern processors, it is desirable to perform limitedinstruction analysis in a predecode stage. As mentioned above, limitedpredecode information may be utilized for instruction group formation.To avoid suboptimal group formation, it would be desirable for predecodeinformation to have a global context. However, global analysis may notbe possible in a predecode stage, as instruction information may not beavailable (e.g., a predecode stage may not have instruction visibilityacross cache boundaries, such as cache line, cache sector, or cachesubline boundaries). Accordingly, decisions on group formation may haveto be made based on limited information, which may lead to significantlydegraded group quality and overall processor performance degradationrather than the sought after improvement to be delivered by decode-timeinstruction optimization (DTIO). According to aspects of the presentdisclosure, feedback is provided on speculative group formation toreduce the possibility of group formation leading to overall processorperformance degradation.

According to an embodiment of the present disclosure, a first analysisclassifies instructions based on instruction classes, e.g., whether aninstruction is a candidate for being a first instruction in a DTIOtwo-instruction group or a second instruction in a two-instructiongroup. According to various embodiments, a group that includes first andsecond instructions is only formed when a suitable combination of firstand second instructions is found (e.g., at the expense of othercriteria). According to one aspect, a group formation unit may group twoinstructions that have not conventionally been a DTIO candidatesequence. In one or more embodiments, whether a DTIO grouping isperformed may be based on exhaustive analysis that provides feedback onthe desirability of past DTIO groups for an instruction pair. Moredetailed group analysis may offer several sets of information (e.g.,compatible classes, instruction hashes, and/or instruction operandhashes) to facilitate identification of relationships betweeninstruction candidates.

As the sets of information require only a limited exchange ofinformation and limited logic to combine (e.g., a single AND gate),comparatively far more information may be utilized in an instructiongrouping decision, by predecoding partial information to identifycandidates for combination during predecode and combining the predecodedinformation during group formation. However, depending on specific codesequences used by an application, one or more code patterns may triggergroup formation for DTIO when DTIO does not apply or DTIO does not offeran advantage. That is, DTIO may degrade processor performance instead ofimproving processor performance. Feedback has not traditionally beenused to determine a best processor operation mode.

In accordance with one or more embodiments of the present disclosure,feedback is employed to determine whether DTIO is effective at improvingperformance. In one embodiment, feedback is tracked at a hardware corelevel. In another embodiment, feedback is tracked at a hardware threadlevel. In other embodiments, feedback may be updated by hardware and/orcontext switched with partitions, processes, and/or threads. Accordingto one aspect of the present disclosure, a cost function is employed todetermine whether speculative micro-architectural optimization (i.e.,DTIO) has been empirically successful. In response to the cost functionindicating the speculative micro-architectural optimization has not beensuccessful in improving processor performance, the speculativemicro-architectural optimization is discontinued.

With reference to FIG. 1, an exemplary data processing environment 100is illustrated that includes a data processing system 110 that isconfigured, according to one or more embodiments of the presentdisclosure, to identify instructions for decode-time instructionoptimization (DTIO) grouping, for example, in view of feedback. Dataprocessing system 110 may take various forms, such as workstations,laptop computer systems, notebook computer systems, desktop computersystems or servers and/or clusters thereof. Data processing system 110includes one or more processing units or processors 102 (each of whichmay include one or more processor cores for executing program code)coupled to a data storage subsystem 104, optionally a display 106, oneor more input devices 108, and a network adapter 109. Data storagesubsystem 104 may include, for example, application appropriate amountsof various memories (e.g., dynamic random access memory (DRAM), staticRAM (SRAM), and read-only memory (ROM)), and/or one or more mass storagedevices, such as magnetic or optical disk drives.

Data storage subsystem 104 includes one or more operating systems (OSs)114 for data processing system 110. Data storage subsystem 104 may alsoinclude application programs, such as a browser 112 (which mayoptionally include customized plug-ins to support various clientapplications), a hypervisor (or virtual machine monitor (VMM)) 116 formanaging one or more virtual machines (VMs) 120 as instantiated bydifferent OS images, and other applications (e.g., a word processingapplication, a presentation application, and an email application) 118.

Display 106 may be, for example, a cathode ray tube (CRT) or a liquidcrystal display (LCD). Input device(s) 108 of data processing system 110may include, for example, a mouse, a keyboard, haptic devices, and/or atouch screen. Network adapter 109 supports communication of dataprocessing system 110 with one or more wired and/or wireless networksutilizing one or more communication protocols, such as 802.x, HTTP,simple mail transfer protocol (SMTP), etc. Data processing system 110 isshown coupled via one or more wired or wireless networks, such as theInternet 122, to various file servers 124 and various web page servers126 that provide information of interest to the user of data processingsystem 110. Data processing environment 100 also includes one or moredata processing systems (DPSs) 150 that are configured in a similarmanner as data processing system 110. In general, data processingsystems 150 represent data processing systems that are remote to dataprocessing system 110 and that may execute OS images that may be linkedto one or more OS images executing on data processing system 110.

Those of ordinary skill in the art will appreciate that the hardwarecomponents and basic configuration depicted in FIG. 1 may vary. Theillustrative components within data processing system 110 are notintended to be exhaustive, but rather are representative to highlightcomponents that may be utilized to implement the present invention. Forexample, other devices/components may be used in addition to or in placeof the hardware depicted. The depicted example is not meant to implyarchitectural or other limitations with respect to the presentlydescribed embodiments.

With reference to FIG. 2A, relevant portions of processor 102 areillustrated in additional detail, according to an embodiment of thepresent disclosure. Processor 102 includes a predecode unit 202 that isconfigured to receive reload data from main memory (e.g., included indata storage subsystem 104) on a cache miss. As is discussed furtherherein, predecode unit 202 is configured to analyze receivedinstructions. For example, predecode unit 202 may analyze all of theinstructions in a cache sector (e.g., thirty-two bytes) or a cache line(e.g., one-hundred twenty-eight bytes) upon reload. In variousembodiments, predecode unit 202 is configured to create instructionproperty information for each of the analyzed instructions. For example,the created instruction property information may indicate whether eachof the instructions is a first candidate instruction or a secondcandidate instruction for an instruction group when an instruction is,for example, a boundary instruction. When the instruction is not aboundary instruction predecode unit 202 may also provide an indicationwhen two adjacent instruction should be grouped. In at least oneembodiment, predecode unit 202 is also configured to modify theinstruction property information based on feedback (as to whether aninstruction pairing has been historically beneficial to the performanceof processor 102) provided by, for example, decode unit 208. In variousembodiments, predecode unit 202 is also configured to initiate storageof the instruction property information in association with theinstructions. For example, the instruction property information may bestored in a memory array of cache unit 204 in conjunction with anassociated instruction or may be stored in another location in cacheunit 204.

Group formation unit 206 is configured to fetch instructions stored incache unit 204 for grouping. Group formation unit 206 examinesinstruction properties to determine how to group fetched instructions.For example, group formation unit 206 may examine a first property of afirst instruction and a second property of a second instruction anddetermine whether the properties for the first and second instructionsare compatible. In accordance with an aspect of the present embodiment,the properties of the first and second instructions correspond to one ormore bits stored in conjunction with an instruction in cache unit 204.In accordance with one aspect, the first and second properties aregenerated by predecode unit 202. For example, group formation unit 206may determine the first instruction is a first instruction candidate fora group and a subsequent second instruction is a second instructioncandidate for a DTIO sequence, i.e., a sequence of instructions whichmay be optimized by DTIO, based on the predecoded instructionproperties.

In accordance with one embodiment, compatible instructions that may forma beneficial DTIO sequence are placed in the same group. In at least oneembodiment, the properties correspond to broad instruction classes thatmay be combined in a DTIO sequence, but not every sequence may be aneligible DTIO sequence. In accordance with one embodiment, any boundaryinstruction that may be a first instruction of a DTIO sequence is markedand every boundary instruction that may be a second instruction of aDTIO sequence is marked. In general, not every combination of any firstinstruction of an instruction sequence with any second instruction of aninstruction sequence is a DTIO sequence. In response to the propertiesfor the first and second instructions not being compatible, groupformation unit 206 performs group formation according to anothercriteria (e.g., to maximize groups or minimize groups).

In one embodiment, group formation unit 206 receives feedback directlyfrom decode unit 208. In response to the properties for the first andsecond instructions being compatible and the feedback (provided bydecode unit 208) indicating grouping the first and second instructionsresults in a valid DTIO sequence, group formation unit 206 continues togroup the first and second instructions when presented in an instructionstream. In accordance with another embodiment, properties stored, forexample, in instruction cache unit 204 are updated based on thefeedback. In another embodiment, feedback is further used to indicatethat combining instructions in an instruction group has beenhistorically beneficial in improving performance of processor 102. Inthis case, instruction properties are updated to cause group formationunit 206 to form a group with the first and second instructioncandidates.

In accordance with another embodiment, properties stored, for example,in cache unit 204 are updated. In response to the feedback indicatingthe instruction grouping has not been historically beneficial, groupformation unit 206 does not form a group with the first and secondinstruction candidates. Group formation unit 206 may form an instructiongroup based on other criteria when feedback indicates an instructiongrouping has not been historically beneficial. When group formation unit206 does not receive feedback directly from decode unit 208 (e.g.,predecode unit 202 received the feedback from decode unit 208 andincorporated the feedback when creating the instruction propertyinformation), in response to the properties for the first and secondinstructions being compatible group formation unit 206 forms a groupwith the first and second instruction candidates. In another embodiment,cache unit 204 receives the feedback and updates instruction propertyinformation stored in cache unit 204 directly.

Decode unit 208 is configured to perform a full decode on groupedinstructions and perform DTIO (e.g., combining compatible instructionsthat are grouped or improving sequences of compatible instructions bytransforming them into another group that is more efficient to executeby one or more of instruction scheduling unit (ISU) 214 and executionunits 216). In various embodiments, decode unit 208 is also configuredto provide feedback to group formation unit 206, instruction cache unit204, and/or predecode unit 202 based on whether grouping of particularinstruction pairs has improved processor 102 performance. Depending onthe instruction type, microcode (ucode) unit 210 may be employed togenerate microcode for a given instruction. Multiplexer 212 selectswhether an output from decode unit 208 or microcode unit 210 is providedto ISU 214. ISU 214 is configured to dispatch instructions to variousimplemented execution units (floating-point units, fixed-point units,etc.) 216 based on instruction type.

FIG. 2B illustrates an exemplary instruction group formation process 250that may be performed by group formation unit 206. Process 250 isinitiated in block 252, for example, in response to processor 102 beingpowered up. Next, in block 254, group formation unit 206 completes acurrent instruction grouping and begins a new instruction group as acurrent instruction group. Then, in block 256, group formation unit 206adds a current instruction to the current instruction group. Next, indecision block 258, group formation unit 206 determines whether thecurrent instruction is an instruction that must be a last instruction inan instruction group. In response to the current instruction being aninstruction that must be last in an instruction group, control passesfrom block 258 to block 260 where a next instruction is made the currentinstruction. From block 260 control transfers to block 254. In responseto the current instruction not being an instruction that must be a lastinstruction for an instruction group, control passes from block 258 toblock 262 where a next instruction is made the current instruction.

Next, in decision block 264, group formation unit 206 determines whetherthe current instruction is an instruction that must be a firstinstruction in an instruction group. In response to the currentinstruction being an instructions that must be a first instruction in ancurrent instruction group, control passes from block 264 to block 254.In response to the current instruction not being an instruction thatmust be a first instruction for an instruction group, control passesfrom block 264 to decision block 266. In block 266 group formation unit206 determines whether the current instruction will fit into the currentinstruction group. In response to determining the current instructionwill fit into the current instruction group control transfers from block266 to block 256. In response to determining the current instructionwill not fit into the current instruction group control transfers fromblock 266 to block 254. Those skilled in the art will understand thatwhile process 250 is shown as operating sequentially on eachinstruction, the illustrated blocks may be reordered and or performed inparallel on a variety of embodiments while processor 102 is powered up.

With reference to FIG. 2C, an exemplary process 270 is illustrated fordecode unit 208. Decode unit 208 is adapted to perform instructiondecoding of instruction groups and DTIO for instruction groups. In oneexemplary embodiment, the instruction groups processed by process 270 ofdecode unit 208 are formed in accordance with group formation unit 206performing process 250.

Process 270 is initiated in block 272 at which point control transfersto block 274. In block 274 an instruction group is received by decodeunit 208. In block 276 decode unit 208 determines whether theinstruction group contains a sequence that can be optimized with DTIO byreplacing a first sequence of received instructions with a secondsequence of equivalent instructions that are adapted to execute in amore efficient manner. In response to the instruction group notincluding a sequence that may be improved with DTIO, control passes toblock 278. In block 278 each instruction in the instruction group isdecoded in accordance with the decoding requirements of processor 102and, in particular, with the decoding requirements of ISU 214 andexecution units 216 to an appropriate internal format. Control thenpasses from block 278 to block 294, where the decoded internal format ispassed to a next stage. From block 294 control transfers to block 274.

In response to the group including a sequence that may be improved usingDTIO, control passes from block 276 to block 280. In block 280, thecurrent instruction group has been identified as containing a DTIOsequence and a determination is made as to whether the DTIO sequencecorresponds to a first DTIO sequence. If the current instruction groupcontains a first DTIO sequence in block 280, control passes from block280 to block 284. In block 284, the internal format of processor 102(for the optimized (output) instruction execution sequence correspondingto the first (input) instruction execution sequence corresponding to afirst DTIO sequence) is generated responsive to detecting the firstinstruction execution sequence. Control then passes from block 284 toblock 292, where instructions that are not part of the DTIO sequence areindividually decoded to the internal format. From block 292 controltransfers to block 294.

If the current instruction group does not contain a first DTIO sequencein block 280, control passes from block 280 to block 282. In block 282,as the current instruction group has been identified as containing aDTIO sequence, a determination is made as to whether the DTIO sequencecorresponds to a second DTIO sequence. If the current instruction groupcontains a second DTIO sequence in block 282, control passes from block282 to block 286. In block 286, the internal format of processor 102(for the optimized (output) instruction execution sequence correspondingto the second (input) instruction execution sequence corresponding to asecond DTIO sequence) is generated responsive to detecting the secondinstruction execution sequence. Control then passes from block 286 toblock 292. If the current instruction group does not contain a secondDTIO sequence in block 282, control passes from block 282 to block 290.In an exemplary embodiment with three DTIO sequences, in block 290 (whencontrol passes from block 282 to block 290), the sequence of blocks 276,280, 282 has established that the current instruction group contains aDTIO sequence and that the DTIO sequence does not correspond to a firstDTIO sequence or a second DTIO sequence.

Consequently, in block 290, the current instruction group is identifiedas including a third DTIO sequence and the internal format of processor102 (for the optimized (output) instruction execution sequencecorresponding to the third (input) instruction execution sequencecorresponding to a third DTIO sequence) is generated responsive todetermining the presence of the third instruction execution sequence.Control then passes from block 290 to block 292. As mentioned above, inblock 292 any instructions in the instruction group not corresponding toinstructions of a detected and optimized DTIO sequence are decoded tothe internal format of processor 102 and control then passes from block292 to block 294. In block 294, the internal format corresponding toinstructions having been at least one of decoded and generated by atleast one of blocks 278, 284, 286, 290, and 292 is transferred to thenext pipeline stage (for example, to ISU 214 via multiplexer 212, in oneexemplary embodiment) and control passes from block 294 to 274. Thoseskilled in the art will understand that while process 270 is shown asoperating sequentially on each instruction, the illustrated blocks maybe reordered and/or performed in parallel on a variety of embodimentswhile processor 102 is powered up.

With reference to FIG. 3, an exemplary instruction sequence 300 for aprocessor is illustrated with a group size of two. When only intra-groupfusion is employed on a two instruction group, a probability of missinga fusion opportunity exists. As should be appreciated, instructions haveto be in a same instruction group in order to be combined (i.e., fused).For example, assume two adjacent instructions in an instruction streamare add instructions, one of which adds a first value and the other ofwhich adds a second value to a same register. If the two addinstructions are in different groups, the two add instructions cannot becombined. However, if the two add instructions are in the same group,the two instructions can be combined into a single add instruction (thatadds the sum of the first and second values to the register) by a decodeunit for more efficient execution. That is, when groups are formedsolely based on a position of an instruction in an instruction sequence,a fusion opportunity may be missed.

For inter-group fusion, fusing two instruction patterns will not resultin a reduction of the number of operations to be performed, but mayprovide relief on critical paths by shortening dependency chains. Ininstruction sequence 300 of FIG. 3 fusion can occur in the decode unitfor the ‘LWA’ and ‘SLDI’ instructions, as the instructions are in thesame group (i.e., group A). With reference to FIG. 4, an instructionsequence 400 is illustrated in which a fusion opportunity is missed asinstructions that could have been grouped (i.e., the ‘LWA’ and ‘SLDI’instructions) are in different groups (i.e., group ‘X’ and group ‘Y’,respectively).

Missed fusion opportunities may be addressed based on creating groupboundaries based on detecting fusion candidates that may represent astart of a DTIO sequence. With reference to FIG. 5, an instructionsequence 500 is illustrated in which starting a new group ‘U’ responsiveto the detection of an ‘ADDIS’ instruction based on local information(i.e., responsive to the detection of the ‘ADDIS’ instruction only) mayimprove processor performance (as fusion can occur between the ‘ADDIS’and ‘LD’ instructions). It should be appreciated that informationutilized to form groups may be limited due to, for example, limitedvisibility, wire reach, and cache predecode limitations in general(e.g., bit limitations) or specific cache predecode limitations at cachesector and cache line boundaries.

With reference to FIG. 6, an instruction sequence 600 is illustrated inwhich excessive singletons (i.e., groups formed consisting of a singleinstruction) degrade performance and prevent more efficient groupformation with two instruction groups when a new instruction group isstarted responsive to an instruction that corresponds to a firstinstruction of a DTIO sequence. As such, it is desirable to identifypossible sequences based on the decoding of more than a singleinstruction, even when predecode is able to predecode instructions inisolation or instructions within a cache unit (e.g., a cache sector,cache subline, or cache line). In general, cache sector boundaries andcache line boundaries prevent identification of a next instruction by apredecode unit, as bordering instructions (i.e., a first instruction ina subsequent cache sector or subsequent cache line) is not usuallyavailable for inspection by the predecode unit.

According to aspects of the present disclosure, speculative (i.e.,probabilistic) instruction pairing is employed. For example, a firstinstruction in an instruction sequence may be identified as a fusionfirst instruction candidate and a second instruction in the instructionsequence may be identified as a fusion second instruction candidate.Exemplary logic for implementing probabilistic instruction pairing maytake the following form:

IF i0.candidate_for_1^(st) AND i1.candidate_for_2^(nd) THEN start newgroup at i0 to group i0, i1 ELSE continue current group formationpattern

In at least one embodiment, group formation including probabilistic orspeculative pairing is performed in conjunction with a modified groupformation logic of process 250 of FIG. 2B, e.g., as shown inprobabilistic group formation process 730 of FIG. 7A. More specifically,in at least one exemplary embodiment, exemplary logic implements process730 of FIG. 7A and, more specifically, the test of block 748. In oneembodiment, a new group is only started when a DTIO candidate sequencedoes not fit in a current instruction decode group in its entirety.Advantageously, only one signal for each of the first instruction andsecond instruction have to be considered. In various embodiments, a testfor a possible DTIO sequence can be performed with a single AND gate,rather than logic requiring the analysis of up to thirty-two bits ormore per instruction using many levels of logic gates and an associateddelay.

Exemplary logic herein is represented in pseudo-code notation based onconventions in accordance with common hardware description languages,and in particular the VHDL language. However, following pseudo codenotations, the ‘=’ operator may be used for assignment in most instancesrather than the ‘<=’ and ‘:=’ operators, and statements may omit a finalsemicolon, except in cases of possible ambiguity. Further, instructions(and specifically, the instruction bit pattern corresponding to aninstruction or an instruction opcode) are presented by names, such asinstruction (typically, when a single instruction is processed), and‘i0’, ‘i1’, ‘i2’, and so forth, when more than one instruction is beingprocessed and specifically referring to a first, second, third, and soforth, instruction, respectively. Attributes or properties are referredto with a ‘.’ notation commonly associated with structure groupings inprogramming languages and hardware description languages such as VHDL.For example, the ‘instruction.rt_specifier’ refers to the register ‘RT’specifier of the instruction referred to by instruction and ‘i0.class’refers to the property ‘class’ of instruction ‘i0’, and so forth. Themeaning of fields should be apparent from the embodiment descriptions tothose skilled in the art. Specific instructions are represented by theiropcode, or opcode and operands as appropriate, with the comparisonoperator ‘=’ performing a comparison on portions of fields, instructionsopcodes, or entire instructions in accordance with the specified fields,instructions, instruction opcodes, and so forth. In one aspect of pseudonotations, values may be interpreted as ‘FALSE’ when one or more bitvalues corresponds to ‘0’, and as ‘TRUE’ when one or more bits values donot correspond to ‘0’. Finally, high-level actions are described inEnglish.

In general, instruction pairing information may be utilized to createuseful group boundaries. For example, in exemplary instruction sequence500 of FIG. 5 the ‘ADDIS’ instruction is a fusion first instructioncandidate and the ‘LD’ instruction is a fusion second instructioncandidate. Instruction pairing information may also be utilized to avoiduseless boundaries. For example, in exemplary instruction sequence 600of FIG. 6 the ‘ADDIS’ instructions are all fusion first instructioncandidates. As such, forming groups with a single ‘ADDIS’ instructionand an empty slot may be avoided.

As one example, assuming the ‘ADDIS’ instruction is a fusion firstinstruction candidate and the ‘LWZ’ and ‘LD’ instructions are fusionsecond instruction candidates, a determination of whether consecutiveinstructions in an instruction sequence are candidates for grouping maybe determined by implementing the following exemplary logic:

instruction.candidate_for_1st = FALSE instruction.candidate_for_2nd =FALSE IF instruction = ADDIS THEN instruction.candidate_for_1st = TRUEELSIF instruction = LWZ OR instruction = LD THENinstruction.candidate_for_2nd = TRUE END IF

In accordance with one aspect of the present disclosure, computation ofa candidate characteristic for DTIO is performed for each instructionirrespective of a second instruction in conjunction with which theinstruction may be optimized during DTIO. In one embodiment, computationof a DTIO candidate characteristic for a first instruction is performedirrespective of at least a second instruction in conjunction with whichthe instruction may be optimized, when the first instruction is before acache boundary and the second instruction is beyond the cache boundary.In accordance with an embodiment, the DTIO candidate characteristic ofan instruction is computed prior to group formation in group formationunit 206. In accordance with another embodiment, the DTIO candidatecharacteristic is computed prior to entering cache unit 204, and isstored in at least one cache unit, e.g., cache unit 204. In accordancewith at least one embodiment, analysis and storage of an instructioncandidate characteristic property (and optionally other predecodedinstruction properties) is performed in accordance with process 760 ofFIG. 7B.

FIG. 7A illustrates an exemplary instruction group formation process 730that may be performed by group formation unit 206. Process 730 isinitiated in block 732, for example, in response to processor 102 beingpowered up. Next, in block 734, group formation unit 206 completes acurrent instruction grouping and begins a new instruction group as acurrent instruction group. Then, in block 736, group formation unit 206adds a current instruction to the current instruction group. Next, indecision block 738, group formation unit 206 determines whether thecurrent instruction is a last instruction for the current instructiongroup. In response to the current instruction being the last instructionfor the current instruction group, control passes from block 738 toblock 740 where a next instruction is made the current instruction. Fromblock 740 control transfers to block 734. In response to the currentinstruction not being the last instruction for the current instructiongroup (e.g., the current instruction is the first instruction for thecurrent instruction group) in block 738, control passes from block 738to block 742 where a next instruction is made the current instruction.

Next, in decision block 744, group formation unit 206 determines whetherthe current instruction is an instruction that must be a firstinstruction in an instruction group. In response to the currentinstruction being an instructions that must be a first instruction in ancurrent instruction group, control passes from 744 to block 734. Inresponse to the current instruction not being an instruction that mustbe a first instruction for an instruction group, control passes fromblock 744 to decision block 746. In block 746 group formation unit 206determines whether the current instruction will fit into the currentinstruction group. In response to determining the current instructionwill fit into the current instruction group control transfers from block746 to block 748. In response to determining the current instructionwill not fit into the current instruction group control transfers fromblock 746 to block 734.

In block 748 group formation unit 206 determines whether the combinedpredecoded instruction properties (or instruction characteristics) ofcurrent instruction and one or more successive instructions indicatethat the current instruction and one or more successive instructionsrepresent a possible DTIO sequence. In response to determining that thecombined instruction properties of the present instruction and one ormore successive instructions indicate that the current instruction andone or more successive instructions represent a possible DTIO sequence(i.e., the properties are compatible), control transfers from block 748to block 750. In response to determining the DTIO sequence is not apossible DTIO sequence, control transfers from block 748 to block 734.In block 750 group formation unit 206 determines whether the possibleDTIO sequence fits entirely within the current instruction group. Inresponse to the DTIO sequence fitting entirely within the currentinstruction group control transfers from block 750 to block 736. Inresponse to the DTIO sequence not fitting entirely within the currentinstruction group control transfers from block 750 to block 734.

Those skilled in the art will understand that while process 730 is shownas operating sequentially on each instruction, the illustrated blocksmay be reordered and or performed in parallel on a variety ofembodiments while processor 102 is powered up. For example, in at leastone embodiment, an entire possible DTIO sequence is added to a currentinstruction group immediately responsive to a determination in block 750that a possible DTIO sequence will fit in a current group. In at leastone embodiment, the entire possible DTIO sequence is immediately addedto the next instruction group upon the determination in block 750 thatthe DTIO sequence does not fit in the current instruction group. In atleast one embodiment, the determination in block 748 further includes adetermination of whether performing DTIO offers a benefit in accordancewith one or more metrics, e.g., including, but not limited to, metricssuch as overall performance or power consumption, based on instructionexecution feedback, and a sequence that does not offer a benefit is notindicated as a possible DTIO sequence.

With reference to FIG. 7B, an exemplary process 760 is illustrated thatis executed by processor 102, for example, each time instructions arereceived by predecode unit 202. Process 760 is initiated in block 762,at which point control transfers to block 764. In block 764, predecodeunit 202 analyzes received instructions. For example, predecode unit 202may analyze all of the instructions in a cache sector (e.g., thirty-twobytes) or a cache line (e.g., one-hundred twenty-eight bytes). Next, inblock 766, predecode unit 202 creates instruction property informationfor each of the instructions. For example, the created instructionproperty information (e.g., first and second properties of first andsecond candidate instructions) may indicate whether each of theinstructions is a first candidate instruction or a second candidateinstruction for an DTIO candidate sequence. In other embodiments, theinstruction property information may also include additionalinformation. In various embodiments, the first and second properties areindicated by fewer instruction bits than is required for a fullinstruction compare. Then, in block 768, predecode unit 202 initiatesstorage of the instruction property information in association with theinstructions. For example, the instruction property information may bestored in a memory array of cache unit 204 in conjunction with anassociated instruction or may be stored in another location in cacheunit 204. Next, in block 770, process 760 terminates until a next reloadof instructions occurs.

FIG. 7C illustrates an exemplary instruction flow process 780 of one ormore instructions in processor 102 based on instruction property-basedgroup formation in conjunction with feedback. Process 780 is initiatedin block 782, for example, in response to processor 102 issuing aninstruction fetch request. In block 783, a plurality of instructions arefetched and predecoded, including determining instruction propertieswith respect to the identified instruction being a member of a DTIOsequence, to guide group formation to avoid splitting possible DTIOsequences irrespective of determining the actual presence of DTIOsequences. Advantageously, this reduces the decoding performed duringpredecode and group formation, while avoiding splitting of possible DTIOsequences without the cost of performing a full decode and determinationwith respect to the presence of DTIO sequences during group formation.The predecoded information and instruction properties may be stored incache unit 204.

Next, in block 784, instruction groups are formed from a plurality ofinstructions to be grouped based on the compatibility of instructionproperties for a plurality of instructions to determine the possiblepresence of DTIO sequences to a design-established (non-zero) likelihoodbased on the property of a current and one or more next instructionsindicating the membership of the first and next instructions in at leastone DTIO sequence irrespective of the plurality of instructions actuallyconstituting a DTIO sequence. In at least one embodiment, theinstruction properties further encode a position that each DTIO sequencemember has in their respective DTIO sequence. In various embodiments, aDTIO sequence is only detected for a DTIO sequence of n instructions ifthat sequence consists of a first instruction of an identified sequence,sequence class, or sequence class category identified as a firstinstruction of such sequence by the instruction property, followed by asecond instruction of an identified sequence, sequence class, or classcategory identified as a second instruction of such sequence by theinstruction property, sequence class, or sequence class category up toan nth instruction identified as an nth instruction of such sequence ofsuch sequence by the instruction property, sequence class, or sequenceclass category.

In one embodiment, instructions may only include decode information withrespect to their membership and position in any DTIO sequence,identifying them as a first, a second, a third, etc. instruction. Inanother embodiment, DTIO instruction sequences may be grouped in classesof sequences, adapted to reduce false matches and increase thelikelihood of finding true matches and minimize the likelihood of falsematches based on assigning multiple DTIO sequences to each class so asto minimize the likelihood of the occurrence of false sequences, basedon, for example, statistical code occurrences of instructioncombinations, analytical models, or other metrics. In accordance withone aspect, DTIO sequences are combined into sequence classes in amanner to minimize the occurrence of false combinations (i.e.,combinatorial instruction sequences made up of instructions of differentsequences assigned to a class that does not correspond to an actual DTIOsequence). In yet another embodiment, the class may be furthercategorized based on additional sequence characteristics, such asdependence-carrying registers (i.e., registers written by oneinstruction of a sequence and read by another), hashes, or other bitcombinations or bit subsequences.

Advantageously, the use of DTIO sequence information enables designersto create predecoded instruction properties that facilitate increasingthe probability of basing decisions on the possible presence of DTIOsequences irrespective of the need to fully decode instructions todetermine actual presence, optimizing benefit of group “quality”relative to cost of computing and storing predecoded instructionproperties, and logic needed to combine the properties to make adetermination. In accordance with at least one embodiment, group qualityis defined as maximizing the number of instructions in each group whilealso maintaining actual DTIO sequences within the same group to enabledecode logic to perform DTIO. In yet another embodiment, group qualityis defined as group organization so as to optimize overall performance.In accordance with at least one such embodiment, group formation furtherreceives feedback with respect to the benefit of group formation tocollocate a possible DTIO sequence in a group. In at least oneembodiment, when a possible DTIO sequence does not demonstrate anadvantageous performance impact, block 784 will not include a possiblesequence in the set of possible DTIO sequences considered during groupformation.

Next, in block 786, instruction groups are decoded to an internalformat. A determination of the presence of one or more DTIO sequences ina group is made and, responsive to the presence of a DTIO sequence, DTIOis performed to transform a first sequence of instructions expressed ina program instruction sequence into an alternate internal formatsequence having improved instruction execution characteristics. Then, inblock 788, instructions in internal format obtained either byinstruction decoding or DTIO are dispatched by ISU 214 and executed byexecution units 218. Following block 788, process 780 end in block 790.

In accordance with one exemplary embodiment, where possible DTIOsequences are determined in accordance with classification of aninstruction property during predecode is limited to indicating whetheran instruction is a possible first instruction and whether aninstruction is a possible second instruction of a DTIO sequence. Itshould be appreciated that if several two-instruction patterns areimplemented where not every first instruction of a two instructionpattern can be combined with any second instruction of a two instructionpattern that represents a DTIO sequence false matches may be createdbecause group formation determines possible presence based on predecodeinformation irrespective of actual presence. As one example, patternsmay include the following true instruction pairs: ADDIS/LWZ; ADDIS/LD;and EXTSW/SLDI. In this case, the fusion first instruction candidatesinclude the instructions ‘ADDIS’ and ‘EXTSW’ and the fusion secondinstruction candidates include the instructions ‘LWZ’, ‘LD’, ‘SLDI’.False instruction pairs include: ADDIS/SLDI; EXTSW/LWZ; and EXTSW/LD.

In the above example, false matches can occur fifty percent of the timeassuming a uniform distribution of instructions. As one example, thetotal false groupings may be given by the equation:total_false=(#first*#second)−(#patterns). It should be appreciated thatfalse groupings may be larger than true groupings. Conversely, iffalsely identified sequences are rarely expected to appear in realprograms, the occurrence of these patterns may be negligible in realexecution.

According to one aspect, the success of instruction pairing may beimproved by assigning multiple bits to identify different groups ofpatterns. Either one pattern may be assigned to a bit combination ormultiple patterns may be assigned to each bit combinations in a mannerthat frequently occurring two-instruction sequences that are not DTIOsequences do not have a pattern (e.g., with a first instructioncorresponding to a first instruction of a frequently occurringtwo-instruction sequence assigned to a same bit combination as a patternwith a second instruction corresponding to a second instruction of thefrequently occurring non-DTIO two instruction sequence to avoid frequentfalse matches). For example, an embodiment may implement one bit for afusion first instruction candidate, one bit for a fusion secondinstruction candidate, and ‘N’ bits for a candidate class. It should beappreciated that with 2^N classes, the greater ‘N’ the more granularity.

As one example, instruction classes using one class bit may beimplemented with the following exemplary logic:

instruction.candidate_for_1st = FALSE instruction.candidate_for_2nd =FALSE IF instruction = ADDIS THEN instruction.candidate_for_1st = TRUEinstruction.class = 0 ELSIF instruction = EXTSW THENinstruction.candidate_for_1st = TRUE instruction.class = 1 ELSIFinstruction = LWZ OR instruction = LD THEN instruction.candidate_for_2nd= TRUE instruction.class = 0 ELSIF instruction = SLDI THENinstruction.candidate_for_2nd = TRUE instruction.class = 1 END IF

In the above example, the ‘ADDIS’ instruction is a fusion firstinstruction candidate assigned to class ‘0’, the ‘EXTSW’ instruction isa fusion first instruction candidate assigned to class ‘1’, the ‘LWZ’and ‘LD’ instructions are fusion second instruction candidates assignedto class ‘0’, and the ‘SLDI’ instruction is a fusion second instructioncandidate assigned to class ‘1’. For example, a decision on groupformation may be implemented by the following logic (e.g., in accordancewith determination 748 of FIG. 7A):

IF i0.candidate_for_1st AND i1.candidate_for_2nd AND i0.class = i1.classTHEN start new group at i0 to group i0, i1 ELSE continue current groupformation patternAs another example, an embodiment may implement ‘K’ bits for a firstcandidate class (e.g., with two bits ‘00’ corresponding to no candidate)and ‘K’ bits for a second candidate class. It should be appreciated thatfor 2^K−1 classes, granularity increases with ‘K’. This encoding alsoallows an instruction to be a first instruction candidate for one classand a second instruction candidate for another class.

As another example, exemplary logic for implementing instruction classesusing two class bits may take the following form:

instruction.candidate_for_1st_class = 00instruction.candidate_for_2nd_class = 00 IF instruction = ADDIS THENinstruction.candidate_for_1st_class = 01 ELSIF instruction = EXTSW THENinstruction.candidate_for_1st_class = 10 ELSIF instruction = LWZ ORinstruction = LD THEN instruction.candidate_for_2nd_class = 01 ELSIFinstruction = SLDI THEN instruction.candidate_for_2nd_class = 10 ELSIF... <test more instructions, e.g., corresponding to class 11> ... END IF

A decision on group formation may, for example, be implemented by thefollowing exemplary logic:

IF i0.candidate_for_1st_class AND i1.candidate_for_2nd_class AND i0candidate_for_1st_class = i1.candidate_for_2nd_class THEN start newgroup at i0 to group i0, i1 ELSE continue current group formationpattern

In order for DTIO to be performed successfully, not only does thesequence of instructions need to correspond to an optimizable DTIOsequence, but also the dependence relationship between the instructionsmust meet certain criteria. Thus, if instruction operands do not meetrequirements, DTIO cannot be performed and performance may be degradedby prematurely starting a new group, thereby making less efficient useof instruction dispatch and decode facilities without gaining anyadvantage by performing DTIO. For example, the instruction ‘ADDIS r5,r2, 1’ does not fuse with the instruction ‘LWZ r6, r6, 0’, as the sameregisters are not utilized. According to another aspect of the presentdisclosure, register operands are included in matches. In oneembodiment, fixed dependence relationships are associated with eachpattern group and register specifier tests may be included in a testingof a pattern group.

Thus, for example, one instruction property/characteristic tests may beextended in another embodiment to include register dependence checking.In one exemplary register specifier dependence checking implementation,register dependence checking is implemented as follows:

IF i0.candidate_for_1st_class AND i1.candidate_for_2nd_class ANDi0.candidate_for_1st_class = i1.candidate_for_2nd_class ANDi0.rt_specifier = i1.ra_specifier THEN start new group at i0 to groupi0, i1 ELSE continue current group formation pattern

In another embodiment, register operands that must be matched may becaptured by a register characteristic, e.g., a subset or hash ofrelevant operand register specifiers may be used in combination withinstruction classes to determine a qualifying candidate DTIO sequencethat should be combined into a single instruction group. More generally,a register operand may be represented by a code, e.g., represented ascode(reg), that may consist of one or more bits. For example, code (reg)may be represented by: the first bit of a register specified, i.e.,code(reg)=reg[0]; the first two bits of a register specifier combinedwith a logic function such as XOR, i.e., code(reg)=reg[0] XOR reg[1]; aplurality of bits, such as the first two bits, of a register specifier,i.e., code(reg)=reg[1:0]; a combination of all bits of a registerspecifier using several logic gates, e.g., by combining all bits by XOR,i.e., code(reg)=XOR_reduce(reg); or computing a hash code from theregister specifier, i.e., code(reg)=hash(reg). In general, utilizingmore bits improves grouping, albeit at a cost of requiring more storageto store in the instruction cache unit and other structures and morelogic to test for a possible sequence match.

For example, exemplary logic for implementing a register predecode tocompute a register characteristic ‘reg’ may take the following form:

instruction.candidate_for_1st = FALSE instruction.candidate_for_2nd =FALSE IF instruction = ADDIS THEN instruction.candidate_for_1st = TRUEinstruction.reg = code(instruction.rt_specifier) ELSIF instruction =EXTSW THEN instruction.candidate_for_1st = TRUE instruction.reg =code(instruction.rt_specifier) ELSIF instruction = LWZ OR instruction =LD THEN instruction.candidate_for_2nd = TRUE instruction.reg =code(instruction.ra_specifier) ELSIF instruction = SLDI THENinstruction.candidate_for_2nd = TRUE instruction.reg =code(instruction.ra_specifier) END IF

Exemplary logic for group formation using a predecoded registercharacteristic may take the following form:

IF i0.candidate_for_1st AND i1.candidate_for_2nd AND i0.reg = i1.regTHEN start new group at i0 to group i0, i1 ELSE continue current groupformation pattern

Exemplary logic for combining registers and classes may take thefollowing form:

instruction.candidate_for_1st = FALSE instruction.candidate_for_2nd =FALSE IF instruction = ADDIS THEN instruction.candidate_for_1st = TRUEinstruction.class = 0 instruction.reg = code(instruction.rt_specifier)ELSIF instruction = EXTSW THEN instruction.candidate_for_1st = TRUEinstruction.class = 1 instruction.reg = code(instruction.rt_specifier)ELSIF instruction = LWZ OR instruction = LD THENinstruction.candidate_for_2nd = TRUE instruction.class = 0instruction.reg = code(instruction.ra_specifier) ELSIF instruction =SLDI THEN instruction.candidate_for_2nd = TRUE instruction.class = 1instruction.reg = code(instruction.ra_specifier) END IF

Exemplary logic for group formation for considering combinations ofinstructions that may be candidates for DTIO based on the register ‘reg’and class characteristic may take the following form:

IF i0.candidate_for_1st AND i1.candidate_for_2nd AND i0.class = i1.classAND i0.reg = i1.reg THEN start new group at i0 to group i0, i1 ELSEcontinue current group formation pattern

Instead of having two different codes for registers and classes, theregisters and classes can be combined into one characteristic coderepresented, for example, by codeforall(class, reg). In this case,codeforall(class, reg) may be equal to codeforall(class, reg)=class XORhash(reg). Exemplary logic for a combined characteristic “code” forregisters and classes may take the following form:

instruction.candidate_for_1st = FALSE instruction.candidate_for_2nd =FALSE IF instruction = ADDIS THEN instruction.candidate_for_1st = TRUEinstruction.code = codeforall (0, instruction.rt_specifier) ELSIFinstruction = EXTSW THEN instruction.candidate_for_1st = TRUEinstruction.code = codeforall (1, instruction.rt_specifier) ELSIFinstruction = LWZ OR instruction = LD THEN instruction.candidate_for_2nd= TRUE instruction.code = codeforall (0, instruction.ra_specifier) ELSIFinstruction = SLDI THEN instruction.candidate_for_2nd = TRUEinstruction.code = codeforall (1, instruction.ra_specifier) END IF

Exemplary logic for group formation for the combined register and classcode may take the following form:

IF i0.candidate_for_1st AND i1.candidate_for_2nd AND i0.code = i1.codeTHEN start new group at i0 to group i0, i1 ELSE continue current groupformation pattern

In general, class-based instruction pairing can reduce the number offalse matches, but cannot completely eliminate false matches when morepatterns than classes are implemented. In general, some code sequencesmay trigger notable degradation and if known such instruction pairingscan be avoided during compilation. However, for compiled applicationsthat have been previously developed the code sequences that triggernotable degradation that are already compiled cannot be avoided.According to various aspects of the present disclosure, feedback may beemployed to determine cost/benefit for forming groups for DTIO based oninstruction classes. Cost/benefit may then be tracked on a variety ofcriteria. The criteria may be used as a global hardware setting withoutintervention of supervisory software, such as an operating system (OS),or associated with each layer of software abstraction in a system (e.g.,co-routine, thread, process, partition, virtual machine) andsaved/restored by context switching code associated with contextswitching between co-routines, threads, processes, partitions, andvirtual machines, respectively. The global setting in hardware may beper partition (optionally context switched), per process (contextswitched), per thread (software thread context switched or hardwarethread without context switch), per class, or per class andthread/process (and context switched or not context switched).

For example, feedback may be used to capture whether a decision tomodify group formation was successful and a control decision may beadded to group formation using the following exemplary logic:

IF i0.candidate_for_1st AND i1.candidate_for_2nd AND i0.code = i1.codeAND (group_formation_benefit) THEN start new group at i0 to group i0, i1ELSE continue current group formation pattern

Group formation benefit may be determined by implementing a counter thatcounts whether DTIO group formation prediction based on class wascorrect. For example, if a formed DTIO group based on class informationwas beneficial, a counter may be incremented (e.g., counter++). On theother hand, if a formed DTIO group based on class information was notbeneficial, the counter may be decremented (e.g., counter−−). Ingeneral, a benefit may be indicated if the counter is greater than zeroor, more generally, if the counter is greater than a threshold value. Inaccordance with exemplary embodiments, one or multiple counters may bemaintained. In accordance with one or more exemplary embodiments, groupformation benefit counters may be maintained, for example, for aprocessor or a hardware thread, may be associated to a specific class orcode, or to a specific instruction address. Group formation benefit maybe determined using a counter for estimated benefit of group formationbased on expected relative cost of starting a new group incorrectlyversus fusing (statically defined). If a DTIO group formed based onclass information was beneficial a counter for a given DTIO pattern maybe incremented. If a DTIO group formed based on class information wasnot beneficial, a counter that tracks a cost for leaving slots empty maybe decremented.

It should be appreciated that the benefit for making right decisions maybe asymmetric with the penalty for making wrong decisions. Cost andbenefit may be set statically at design time or as configurationparameter, e.g., in configuration registers. Group formation benefit maybe based on expected relative cost of starting a new group incorrectlyversus the benefit of performing DTIO fusing (statically defined atdesign time, during a configuration step prior to system or programoperation, or dynamically measured at runtime). If missing a DTIO groupformation degraded performance, then incrementing a counter indicatesthere would have been a benefit for DTIO. An instruction may be markedto indicate a missed DTIO opportunity due to a group formation limit(e.g., a true opportunity missed may be checked by tracking instructionsacross group boundaries during decode). Instructions may be marked toindicate a consuming instruction used the result of a producinginstruction immediately (i.e., the result is on a critical path). Forexample, if any instruction that is marked is next to commit at themoment it finishes, it was on the critical path and a counter indicatinga DTIO benefit may be incremented.

As another example, when a selection of an instruction to issue leads toan empty issue slot a determination may be made as to whether missing agroup formation degraded performance. Feedback of group formationbenefit may be incorporated in predecode bits. For example, if a groupwas combined because “i0.candidate_for_1st AND i1.candidate_for_2nd ANDi0.code=i1.code” or class, or other equivalent condition and a benefitis not realized then ‘i0’ predecode information and/or ‘i1’ predecodeinformation may be updated such that the instructions are no longergroup candidates. In one exemplary embodiment, this may be performed byupdating an instruction candidate characteristic of an instruction, asmay be stored in an instruction cache, e.g., ‘i0.candidate_for_1st=0’and/or ‘i1.candidate_for_2nd=0’. In accordance with one optimizedembodiment, updating only one candidate characteristic is sufficient tomake a DTIO candidate group a non-candidate, thus reducing the number ofinstruction characteristics that need to be updated.

As previously described, it is desirable for instruction group formationfor DTIO to have a global context to avoid suboptimal group formation.However, global analysis may not be possible due to instructioninformation being unavailable. Accordingly, group formation decisionsmay have to be made based on limited information, which may lead tosignificantly degraded group quality and overall processor performancedegradation. In general, predictive instruction group formation mayprovide suboptimal results when predictions are inaccurate.

Embodiments of the present disclosure combine predictive anddecode-based group formation to generate predecode information based onactual instruction decode information, when actual instruction decodeinformation is available. When actual instruction decode information isnot available, predictive techniques are employed. In one embodiment,full decoding may be implemented for instructions within a cachesegment. In various embodiments, predictive techniques may be employedat cache segment and cache line boundaries. In one or more embodiments,predictive techniques are utilized to initially drive the creation ofpotential DTIO groups. In at least one embodiment, a decode unit thenperforms a full decode of instruction groups and updates predecodeinformation based on actual instruction decode and DTIO sequenceanalysis. While the disclosure focuses on grouping two instructions, thedisclosed techniques can be applied to grouping any number ofinstructions.

In various embodiments, predecode information is generated to facilitategrouping, within an instruction group, instructions that may be jointlyoptimized (e.g., the fusion of two add instructions that add values to asame register). The predecode information is created based on DTIOsequence eligibility when information is available to fully analyzeinstructions for DTIO eligibility. The predecode information may becreated based on class-based prediction of DTIO sequences when fullinstruction analysis cannot be performed (e.g., at cache boundaries).According to one or more aspects, predecode/decode group formation forDTIO is split. Instructions are indicated as a first instruction or asecond instruction in a DTIO sequence by predecoding. If instructionscan be jointly analyzed for DTIO opportunity in predecode, detailedanalysis is performed and the instructions may then be grouped if avalid group is indicated. If instructions cannot be jointly analyzedduring predecoding, class-based analysis is performed. For example,exemplary logic for class-based analysis of boundary instructions maytake the following form:

IF i0.candidate_for_1st AND i1.candidate_for_2nd THEN start new group ati0 to group i0, i1 ELSE continue current group formation pattern

In one embodiment, fully analyzed DTIO sequences are indicated by aseparate property associated with an instruction (e.g., a match bit foran instruction may be set to indicate a next instruction in aninstruction sequence should be grouped with the instruction). In anotherembodiment, boundary instructions are indicated to be one class of aclass-based predictive matching scheme. In yet another embodiment, fullyanalyzed DTIO sequences may be indicated by one class (or one indicator)of a predictive scheme when that class (indicator) is also used forpredictive matching. In another embodiment, class is used to encode apredictive sequence for isolated analysis. Exemplary logic forimplementing predecoding may take the following form:

instruction.known_match = FALSE instruction.candidate_for_1st = FALSEinstruction.candidate_for_2nd = FALSE IF instruction = ADDIS THEN instruction.candidate_for_1st = TRUE IF (next_instruction == LWZ ANDnext_instruction.rs1_specifier =instruction.rt_specfier ANDnext_instruction.rt_specifier = next_instruction.rs1_specifier)instruction.known_match = TRUE ELSIF instruction = LWZ OR instruction =LD THEN --no need to test first instruction because pattern for firstalready performed exhaustive test instruction.candidate_for_2nd = TRUEEND IF

In the above logic, when the ‘ADDIS’ and ‘LWZ’ instructions areutilizing the same target registers, and the first source register ofthe load (‘LWZ’ or ‘LD’) instruction matches that target, thendisplacement fusion is possible and the ‘ADDIS’ and ‘LWZ’ instructionsshould be grouped in a same instruction decode group. If bothinstructions are in the same cache sector, subline, cache line, or otherpredecode group, these properties may be fully checked during predecode,and a fully analyzed DTIO candidate sequence may be marked as such,e.g., with an exemplary ‘instruction.known_match=TRUE’. When the ‘ADDIS’instruction is the last instruction before a cache boundary, the ‘ADDIS’instruction is marked as a first instruction candidate(‘instruction.candidate_for_1st=TRUE’). When an ‘LWZ’ or ‘LD’instruction is not a first instruction after a cache boundary, noseparate distinct testing is performed from the candidate sequenceanalysis testing shown in conjunction with the ‘ADDIS’ instruction. Inat least one embodiment, the testing shown in conjunction with the‘ADDIS’ instruction may be performed in conjunction with an ‘LWZ’ or‘LD’ instruction. When an ‘LWZ’ instruction or an ‘LD’ instruction isthe first instruction encountered following the cache boundary, theinstruction is marked as a second instruction of a DTIO sequencecandidate.

Exemplary logic for implementing predecoding using a shared indicatorfor known candidate sequences and predictive candidate sequence may takethe following form with predicted and known sequences encoded using the‘instruction.candidate_for_1^(st)’ and‘instruction.candidate_for_2^(nd)’ property to detect either a firstknown or second predicted sequence:

instruction.candidate_for_1st = FALSE instruction.candidate_for_2nd =FALSE IF instruction = ADDIS THEN IF (NOT next_instruction_available OR((next_instruction = LWZ or next_instruction = LD) AND next_instruction.rs1_specifier = instruction.rt_specifier  AND next_instruction.rt_specifier =  next_instruction.rs1_specifier)) instruction.candidate_for_1st = TRUE ELSE instruction.candidate_for_1st = FALSE ELSIF instruction = LWZ ORinstruction = LD THEN --no need to test first instruction becausepattern for first already performed exhaustive testinstruction.candidate_for_2nd = TRUE END IF

In the above logic, if a next instruction is not available (i.e., the‘ADDIS’ instruction is the last instruction before a cache boundary) orwhen the ‘ADDIS’ and one of a subsequent ‘LWZ’ or ‘LD’ instructions areutilizing the same registers and ‘LWZ’ or ‘LD’ is the next instruction,the instruction corresponding to the ‘ADDIS’ instruction is marked as afirst instruction candidate (instruction.candidate_for_1st=TRUE), andthe ‘LWZ’ or ‘LD’ instruction is later marked as a second instructioncandidate (instruction.candidate_for_2nd=TRUE). In accordance with thisexemplary embodiment, when both a first ‘ADDIS’ and a second load (‘LWZ’or ‘LD’) instruction is available, the instruction corresponding to the‘ADDIS’ instruction is only marked as a candidate when the DTIO sequencemeets all requirements for a DTIO candidate and the instruction isotherwise marked as not being a candidate, causing a subsequent test(e.g., block 748 of FIG. 7A) to fail and indicate the absence of asequence.

Exemplary logic for implementing predecode using a shared indicator withpartial co-analysis may take the following form:

instruction.candidate_for_1st = FALSE instruction.candidate_for_2nd =FALSE IF instruction = ADDIS THEN IF (NOT next_instruction_available ORnext_instruction = LWZ OR next_instruction = LD)instruction.candidate_for_1st = TRUE ELSE instruction.candidate_for_1st= FALSE ELSIF instruction = LWZ OR instruction = LD THENinstruction.candidate_for_2nd = TRUE END IF

Logic for instruction group formation using two bits for a class maytake the following form:

instruction.candidate_for_1st_class = 00instruction.candidate_for_2nd_class = 00 IF instruction = ADDIS THEN IF(NOT next_instruction_available OR ((next_instruction = LWZ ANDnext_instruction = LD) AND next_instruction.rs1_specifier =instruction.rt_specifier AND next_instruction.rt_specifier target =next_instruction.rs1_specifier)  instruction.candidate_for_1st class =01 ELSIF instruction = EXTSW THEN IF (NOT next_instruction_available OR(next_instruction = SLDI AND next_instruction.rs1_specifier =instruction.rt_specifier AND next_instruction.rt_specifier target =next_instruction.rs1_specifier)  instruction.candidate_for_1st class =10 ELSIF instruction = LWZ OR instruction = LD THEN instruction.candidate_for_2nd class = 01 ELSIF instruction = SLDI THEN instruction.candidate_for_2nd class = 10 ELSIF ... <test for more DTIOcandidate sequences, e.g., using class 11 to encode> END IF

Logic for group formation may take the following form:

IF i0.candidate_for_1st_class AND i1.candidate_for_2nd_class ANDi0.candidate_for_1st_class = i1.candidate_for_2nd class THEN start newgroup at i0 to group i0, i1 ELSE continue current group formationpattern

The above-described boundary approach may be practiced in conjunctionwith virtually any other approach. For example, the above-describedboundary approach may be implemented in conjunction with feedback. Asone example, feedback of group formation success into predecode bits maytake the following form:

IF group was combined because (i0.candidate_for_1st ANDi1.candidate_for_2nd AND i0.code = i1.code; or due to class match, oranother equivalent condition in accordance with the teachings herein)THEN IF decode determines that DTIO cannot be performed update DTIOcandidate characteristic property stored corresponding to instructionsi0 and/or i1 to no longer identify at least one of i0 and/or i1 as acandidate, e.g., i0.candidate_for_1st =0 and i1.candidate_for_2nd =0.

With reference to FIG. 8, an exemplary process 800 is illustrated thatis executed by processor 102, for example, each time group formationunit 206 selects instructions from cache unit 204 for grouping. Process800 is initiated in block 802, at which point control transfers to block804. In block 804 group formation unit 206 examines instructionproperties. For example, group formation unit 206 may examine a firstproperty of a first instruction and a second property of a secondinstruction. Next, in decision block 806, group formation unit 206determines whether the properties for the first and second instructionsare compatible. For example, group formation unit 206 may determine oneinstruction is a first instruction candidate for a decode-timeoptimization sequence and a subsequent instruction is a secondinstruction candidate for a decode-time optimization sequence.

In response to the properties for the first and second instructions notbeing compatible in block 806, control transfers to block 814. In block814, group formation unit 206 performs group formation according toanother criteria (e.g., to maximize the size of groups or minimize thenumber of groups). Then, control transfers from block 814 to block 812,where process 800 terminates until additional instructions are selectedfrom cache unit 204 for grouping. In response to the properties for thefirst and second instructions being compatible in block 806, controltransfers to decision block 808. In block 808, group formation unit 206determines whether feedback (provided by decode unit 208) indicateswhether grouping the first and second instructions of the DTIO candidatesequence in an instruction group has been historically (i.e., duringprevious executions of this sequence) beneficial with respect to abenefit metric (e.g., improving performance) of processor 102. Inresponse to the feedback indicating the instruction grouping has notbeen historically beneficial, control transfers from block 808 to block814. In response to the feedback indicating the instruction grouping hasbeen historically beneficial, control transfers from block 808 to block810. In block 810, group formation unit 206 groups the first instructionand the second instruction in an instruction group. From block 810control transfers to block 812.

In accordance to one embodiment, when no feedback information isavailable to determine a benefit in accordance with prior executions ofa first and second instruction as a DTIO sequence, control may pass fromblock 808 to block 810. In accordance with one such embodiment,measuring the benefit derived from performing DTIO is automaticallyinitiated for a sequence not having such benefit information. In anotherembodiment, benefit information is measured continuously forinstructions having been optimized by DTIO. In yet another embodiment,control may transfer from block 808 to yet another block that initiatesbenefit measurement for the subject sequence prior to creating a groupthat includes the subject first and second instructions. In yet otherembodiments, measurement of a benefit, e.g., a performance benefit, maybe performed when DTIO is not performed by determining whetherinstructions that are candidates for decode-time optimizations are on acritical path when the benefit metric is performance (e.g., as expressedin aggregate instruction latency).

In accordance with one embodiment, benefit corresponds to performance,e.g., the number of execution cycles saved (or wasted) by performingDTIO. In another embodiment, benefit corresponds to power dissipation orenergy usage, e.g., the number of Watts or Joules saved (or wasted) byperforming DTIO. In yet other embodiments, other measurements, such aspeak voltage swings, an aggregate benefit, e.g., power/performancecomposite metrics, such as an energy-delay product, may be measured. Inat least one embodiment, the benefit metric may be selectable via aconfiguration setting and the configuration setting may be setresponsive to environment characteristics (e.g., running on battery orrunning connected to a power source) and/or configuration settings(optimizing for high performance, low power consumption, balancing bothmetrics, and so forth).

In yet another embodiment, where instructions are identified ascandidates for DTIO speculatively and without fully decoding instructioncharacteristics to determine whether instructions are in factcompatible, benefit information may be based on a determination of DTIObeing successfully performed by decode logic adapted to perform DTIO.

A variety of techniques can be used to measure benefits. In accordancewith one embodiment, a processor may initially perform the same sequencetwice (with and without performing DTIO) and measure the latency, power,voltage swing, energy-delay product, or other metric associated withboth executions and directly compare the metric to determine apreferable execution sequence. To avoid the cost of double execution, aprocessor may also randomly decide to perform (or not perform) DTIOduring the first few executions, and compare an average (or aggregate,or other metric summarizing multiple such executions) of the randomlyselected one way of execution (e.g., using DTIO) of such sequence to theaverage (or aggregate, or other metric summarizing multiple suchexecutions) of the randomly selected another way of execution (e.g.,without using DTIO) of such sequence to determine the more beneficialexecution sequence. In yet another embodiment, performance monitoringcounters may be sampled, to determine the impact of performing DTIO onvarious characteristics, e.g., average instruction latency, powerdissipation, or another metric.

In one embodiment, when candidate instructions that are combinable usingDTIO are not combined the candidate instructions are marked fortracking. When a tracked instruction appears in the critical path (e.g.,being a marked instruction that is a next to completed instruction in anout-of-order processor) the fact is used as an indicator that DTIO isbeneficial for performance. Similarly, other metrics may be derived bydetermining whether a marked instruction causes excessive powerconsumption or voltage swings, and so forth.

Accordingly, techniques have been disclosed herein that advantageouslygroup instructions for decode-time instruction optimization.

The present invention may be a system, a method, and/or a computerprogram product. The computer program product may include a computerreadable storage medium (or media) having computer readable programinstructions thereon for causing a processor to carry out aspects of thepresent invention.

The computer readable storage medium can be a tangible device that canretain and store instructions for use by an instruction executiondevice. The computer readable storage medium may be, for example, but isnot limited to, an electronic storage device, a magnetic storage device,an optical storage device, an electromagnetic storage device, asemiconductor storage device, or any suitable combination of theforegoing. A non-exhaustive list of more specific examples of thecomputer readable storage medium includes the following: a portablecomputer diskette, a hard disk, a random access memory (RAM), aread-only memory (ROM), an erasable programmable read-only memory (EPROMor Flash memory), a static random access memory (SRAM), a portablecompact disc read-only memory (CD-ROM), a digital versatile disk (DVD),a memory stick, a floppy disk, a mechanically encoded device such aspunch-cards or raised structures in a groove having instructionsrecorded thereon, and any suitable combination of the foregoing. Acomputer readable storage medium, as used herein, is not to be construedas being transitory signals per se, such as radio waves or other freelypropagating electromagnetic waves, electromagnetic waves propagatingthrough a waveguide or other transmission media (e.g., light pulsespassing through a fiber-optic cable), or electrical signals transmittedthrough a wire.

Computer readable program instructions described herein can bedownloaded to respective computing/processing devices from a computerreadable storage medium or to an external computer or external storagedevice via a network, for example, the Internet, a local area network, awide area network and/or a wireless network. The network may comprisecopper transmission cables, optical transmission fibers, wirelesstransmission, routers, firewalls, switches, gateway computers and/oredge servers. A network adapter card or network interface in eachcomputing/processing device receives computer readable programinstructions from the network and forwards the computer readable programinstructions for storage in a computer readable storage medium withinthe respective computing/processing device.

Computer readable program instructions for carrying out operations ofthe present invention may be assembler instructions,instruction-set-architecture (ISA) instructions, machine instructions,machine dependent instructions, microcode, firmware instructions,state-setting data, or either source code or object code written in anycombination of one or more programming languages, including an objectoriented programming language such as Smalltalk, C++ or the like, andconventional procedural programming languages, such as the “C”programming language or similar programming languages. The computerreadable program instructions may execute entirely on the user'scomputer, partly on the user's computer, as a stand-alone softwarepackage, partly on the user's computer and partly on a remote computeror entirely on the remote computer or server. In the latter scenario,the remote computer may be connected to the user's computer through anytype of network, including a local area network (LAN) or a wide areanetwork (WAN), or the connection may be made to an external computer(for example, through the Internet using an Internet Service Provider).In some embodiments, electronic circuitry including, for example,programmable logic circuitry, field-programmable gate arrays (FPGA), orprogrammable logic arrays (PLA) may execute the computer readableprogram instructions by utilizing state information of the computerreadable program instructions to personalize the electronic circuitry,in order to perform aspects of the present invention.

Aspects of the present invention are described herein with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems), and computer program products according to embodiments of theinvention. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer readable program instructions.

These computer readable program instructions may be provided to aprocessor of a general purpose computer, special purpose computer, orother programmable data processing apparatus to produce a machine, suchthat the instructions, which execute via the processor of the computeror other programmable data processing apparatus, create means forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks. These computer readable program instructionsmay also be stored in a computer readable storage medium that can directa computer, a programmable data processing apparatus, and/or otherdevices to function in a particular manner, such that the computerreadable storage medium having instructions stored therein comprises anarticle of manufacture including instructions which implement aspects ofthe function/act specified in the flowchart and/or block diagram blockor blocks.

The computer readable program instructions may also be loaded onto acomputer, other programmable data processing apparatus, or other deviceto cause a series of operational steps to be performed on the computer,other programmable apparatus or other device to produce a computerimplemented process, such that the instructions which execute on thecomputer, other programmable apparatus, or other device implement thefunctions/acts specified in the flowchart and/or block diagram block orblocks.

The flowchart and block diagrams in the Figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods, and computer program products according to variousembodiments of the present invention. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof instructions, which comprises one or more executable instructions forimplementing the specified logical function(s). In some alternativeimplementations, the functions noted in the block may occur out of theorder noted in the figures. For example, two blocks shown in successionmay, in fact, be executed substantially concurrently, or the blocks maysometimes be executed in the reverse order, depending upon thefunctionality involved. It will also be noted that each block of theblock diagrams and/or flowchart illustration, and combinations of blocksin the block diagrams and/or flowchart illustration, can be implementedby special purpose hardware-based systems that perform the specifiedfunctions or acts or carry out combinations of special purpose hardwareand computer instructions.

While the invention has been described with reference to exemplaryembodiments, it will be understood by those skilled in the art thatvarious changes may be made and equivalents may be substituted forelements thereof without departing from the scope of the invention. Inaddition, many modifications may be made to adapt a particular system,device or component thereof to the teachings of the invention withoutdeparting from the essential scope thereof. Therefore, it is intendedthat the invention not be limited to the particular embodimentsdisclosed for carrying out this invention, but that the invention willinclude all embodiments falling within the scope of the appended claims.Moreover, the use of the terms first, second, etc. do not denote anyorder or importance, but rather the terms first, second, etc. are usedto distinguish one element from another.

The terminology used herein is for the purpose of describing particularembodiments only and is not intended to be limiting of the invention. Asused herein, the singular forms “a”, “an” and “the” are intended toinclude the plural forms as well, unless the context clearly indicatesotherwise. It will be further understood that the terms “comprises”and/or “comprising,” when used in this specification, specify thepresence of stated features, integers, steps, operations, elements,and/or components, but do not preclude the presence or addition of oneor more other features, integers, steps, operations, elements,components, and/or groups thereof.

The corresponding structures, materials, acts, and equivalents of allmeans or step plus function elements in the claims below, if any, areintended to include any structure, material, or act for performing thefunction in combination with other claimed elements as specificallyclaimed. The description of the present invention has been presented forpurposes of illustration and description, but is not intended to beexhaustive or limited to the invention in the form disclosed. Manymodifications and variations will be apparent to those of ordinary skillin the art without departing from the scope and spirit of the invention.The embodiments were chosen and described in order to best explain theprinciples of the invention and the practical application, and to enableothers of ordinary skill in the art to understand the invention forvarious embodiments with various modifications as are suited to theparticular use contemplated.

What is claimed is:
 1. A processor, comprising: a processor core; and amemory coupled to the processor core, wherein the processor core isconfigured to: determine whether a first property of a first instructionand a second property of a second instruction in an instruction streamare compatible, wherein the first instruction is a last instructionbefore a cache boundary and the second instruction is an initialinstruction after the cache boundary; group the first instruction andthe second instruction in a same decode-time instruction optimizationgroup in response to the first and second properties being compatibleand a feedback value generated by a feedback function indicating thesame decode-time instruction optimization group has been historicallybeneficial with respect to a benefit metric of the processor; and groupthe first and second instructions in different decode-time instructionoptimization groups in response to the first and second properties beingcompatible and the feedback value indicating the grouping of the firstand second instructions in the same decode-time instruction optimizationgroup has not been historically beneficial.
 2. The processor of claim 1,wherein the another criteria corresponds to maximizing a number ofinstructions in instruction groups or minimizing instruction groups. 3.The processor of claim 1, wherein the first and second properties areassociated with instruction classes and/or instruction registers.
 4. Theprocessor of claim 3, wherein the instruction classes are represented bya single bit or multiple bits.
 5. A data processing system, comprising:a processor; and a memory coupled to the processor, wherein theprocessor is configured to: determine whether a first property of afirst instruction and a second property of a second instruction in aninstruction stream are compatible, wherein the first instruction is alast instruction before a cache boundary and the second instruction isan initial instruction after the cache boundary; group the firstinstruction and the second instruction in a same decode-time instructionoptimization group in response to the first and second properties beingcompatible and a feedback value generated by a feedback functionindicating the same decode-time instruction optimization group has beenhistorically beneficial with respect to a benefit metric of theprocessor; and group the first and second instructions in differentdecode-time instruction optimization groups in response to the first andsecond properties being compatible and the feedback value indicating thegrouping of the first and second instructions in the same decode-timeinstruction optimization group has not been historically beneficial. 6.The data processing system of claim 5, wherein the another criteriacorresponds to maximizing a number of instructions in instruction groupsor minimizing instruction groups.
 7. The data processing system of claim5, and wherein the first and second properties are associated withinstruction classes and/or instruction registers.
 8. The data processingsystem of claim 7, where the instruction classes are represented by asingle bit or multiple bits.